package com.yanhui.utils.qq;

import com.yanhui.utils.http._cmsUtils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @Description _qqUtils
 * @Author yanhui
 * @Date 2018-11-12 11:41
 */
public class _qqUtils {
    private final static Pattern emailer = Pattern.compile("\\w+?@\\w+?.com");

    public static String getQQEmail(String url, _cmsUtils cms) {
        String encoding = "UTF-8";
        String result = "";
        String htmlSource = cms.getHtmlResourceByUrl(url,encoding);
        Matcher matchr = emailer.matcher(htmlSource);
        while (matchr.find()) {
            String email = matchr.group();
            if(email.contains("@qq.com")){
                result += email+";";
            }
        }
        return result;
    }
}
